let list = document.querySelector('.list')
let foot = document.querySelector('.footer1>div>b:nth-of-type(3)')
let span = document.querySelector('span')
fetch('http://chst.vip:1234/api/getcoupon')
    .then(body => body.json())
    .then(res => {
        let arr = res.result
        console.log(arr)
        let domStr = ''
        arr.forEach(item => {
            domStr += `<div><img src="../images/6.png" couponid=${item.couponId}>
        <p>${item.couponTitle}</p>
        </div>`
            list.innerHTML = domStr
        })
    })
list.onclick = function (e) {
    console.log(e.target)
    let _this = e.target
    let id = _this.getAttribute('couponid')
    id = Number(id)
    location.href = './../html/youhuixiangqing.html?couponid=' + id
    console.log(id)

}



span.onclick = function () {
    location.href = "../index.html"
}
foot.onclick = function () {
    location.href = "../html/youhuijuan.html"
}